package com.sh.message.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.rocketmq.client.exception.MQClientException;
import sh.dto.ResultDto;
import sh.entity.Message;
import com.sh.message.service.MessageService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (Message)表控制层
 *
 * @author makejava
 * @since 2021-05-10 16:33:38
 */
@RestController
@RequestMapping("message")
@Api("aaaaaaaaaa")
public class MessageController {
    /**
     * 服务对象
     */
    @Resource
    private MessageService messageService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public Message selectOne(Integer id) {
        return this.messageService.queryById(id);
    }


    /**
     * 新增
     * @param message
     * @return
     * @throws MQClientException
     */
    @PostMapping("/add")
    @ApiOperation(value = "获取用户信息", notes = "测试用")
    public ResultDto add(Message message) throws MQClientException {
        return messageService.add(message);
    }


}
